package com.yuneec.droneservice.command;

import com.MAVLink.yuneec.msg_mav_rc_cmd_ack;
import com.yuneec.droneservice.model.JoystickMap;
import com.yuneec.droneservice.request.IResponse;

/**
 * Created by gjw on 2017/3/27.
 */

public class SetJoystickMap extends BaseCommand {
    private final short[] data;

    public SetJoystickMap(JoystickMap map) {
        super(MAV_RC_COMMAND.MAV_RC_CMD_SET_CH_MAP);
        data = new short[4];
        data[0] = (short) map.getCh1();
        data[1] = (short) map.getCh2();
        data[2] = (short) map.getCh3();
        data[3] = (short) map.getCh4();
    }

    @Override
    protected short[] body() {
        return data;
    }

    @Override
    public IResponse toResponse(msg_mav_rc_cmd_ack ack) {
        int code = ack.code;
        return new IResponse(ids(), code);
    }
}
